package cn.haoshuai.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import cn.haoshuai.entity.User;
import cn.haoshuai.service.UserService;
@Controller
@Scope("prototype")
public class LoginAction {
	private String name;
	private String password;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	@Resource
	UserService userService;
	public String login(){
		System.out.println("name:"+name+";"+"password:"+password);
		User user = userService.findUserByName(name,password);
		if (user != null && user.getPassword().equals(password)) {
			return "success";
		}
		return "error";
		
		
	}
	
}
